package main

import (
	"bytes"
	"fmt"
	"strings"
)

func main() {

	stringIndex()
	stringBuilder()
}

func stringIndex() {
	tracker := "死神来了,bye 死神"
	//下标从0开始，comm为12
	comm := strings.Index(tracker, ",")
	//截取从comm（包含）开始以后的部分
	a := tracker[comm:]
	//下标从0开始，pos为1
	pos := strings.Index(a, "bye")
	b := tracker[comm+pos:]
	fmt.Println(comm, a, pos, b)
}

func stringBuilder() {
	hammer := "吃我一锤"
	die := "死吧"
	var stringBuilder bytes.Buffer
	stringBuilder.WriteString(hammer)
	stringBuilder.WriteString(die)
	fmt.Printf(stringBuilder.String())
}
